package kz.epam.homedevices;

import java.util.Objects;

/**
 *
 * @author Knoppix
 */
public abstract class ElectricalDevice{

    private Double cardinality;
    private String maker;
    private boolean powerOn;

    public ElectricalDevice() {
    }

    public ElectricalDevice(String maker, Double cardinality, boolean powerOn) {
        this.maker = maker;
        this.cardinality = cardinality;
        this.powerOn = powerOn;
    }

    public Double getCardinality() {
        return cardinality;
    }

    public void setCardinality(Double cardinality) {
        this.cardinality = cardinality;
    }

    public String getMaker() {
        return maker;
    }

    public void setMaker(String maker) {
        this.maker = maker;
    }

    public boolean isPowerOn() {
        return powerOn;
    }

    public void setPowerOn(boolean powerOn) {
        this.powerOn = powerOn;
    }

    @Override
    public String toString() {
        return "maker = " + this.maker + ", cardinality = " + this.cardinality + ", power on is " + this.powerOn;
    }

    @Override

        public int hashCode() {
        int hash = 5;
        hash = 53 * hash + Objects.hashCode(this.cardinality);
        hash = 53 * hash + Objects.hashCode(this.maker);
        hash = 53 * hash + (this.powerOn ? 1 : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ElectricalDevice other = (ElectricalDevice) obj;
        if (!Objects.equals(this.cardinality, other.cardinality)) {
            return false;
        }
        if (!Objects.equals(this.maker, other.maker)) {
            return false;
        }
        if (this.powerOn != other.powerOn) {
            return false;
        }
        return true;
    }
}
